<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>我的收藏</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

  </head>
  <style type="text/css">
 <!--
 body{
	background-image:url('<%=basePath%>images/background4.jpg');
	background-repeat:no-repeat;
	}
.tb_hr{ width:100%;height:0px;border:none;border:1px solid #400000;}

.topic_title{
	width:100%;
	height:30px;
	color:#400000;
	font-size:14pt;
	font-family:微软雅黑;
}
.attach_info{
	width:50%;
	height:20px;
	float:left;
	color:green;
	font-size:10pt;
	font-family:微软雅黑;
}

	div.topic_title a:link {color:#400000;text-decoration:none;font-size:11pt;font-family:微软雅黑;} /* 未访问的链接 */
	div.topic_title a:visited {color:#400000;text-decoration:none;font-size:11pt;font-family:微软雅黑;} /* 已访问的链接 */
	div.topic_title a:hover {color:#400000;text-decoration:underline;font-size:11pt;font-family:微软雅黑;} /* 鼠标移动到链接上 */
	div.topic_title a:active {color: #400000;font-size:11pt;font-family:微软雅黑;} /* 选定的链接 */
-->
</style>
<script type="text/javascript">
	function cancelFavorite(){
		var cancelFavoriteTopicId=document.getElementById("cancelFavoriteTopicId").value;
		if (window.confirm("您确定要取消收藏吗？")) {
			window.location = "club_cancelFavoriteTopicAction?favoritetopicid="+cancelFavoriteTopicId;
		}else {
			return false;
		}
	}
</script>
  <body>
  	    <jsp:include page="../head.jsp"></jsp:include>
  	    <div class="rightcase">
  	    	<div style="width:80%;height:500px;margin:0 auto;padding:20px;">
  	    	
	  	    	<s:iterator id="attr" value="topiclist" status="u">
	  	    		<div style="width:80%;height:50px;float:left;">
		  	    		<div class="topic_title">
		  	    			<a href="<%=basePath%>club_reviewTopicAction?page=1&rows=10&topicid=<s:property value="#attr.topicId"/>">
		  	    				<s:property value="#attr.topicTitle" />
		  	    			</a>
		  	    		</div>
		  	    		<div class="attach_info">
		  	    			收藏于<s:property value="favoritetopiclist[#u.index].favoriteTime"/>
		  	    		</div>
		  	    	</div>
	  	    		<div style="width:20%;height:50px;float:left;line-height:50px;">
	  	    			<input type="button" value="取消收藏" onclick="cancelFavorite()"/>
	  	    			<input type="hidden" id="cancelFavoriteTopicId" value="<s:property value='favoritetopiclist[#u.index].favoriteTopicId'/>" />
	  	    		</div>
	  	    		<div style="clear:both"><hr class="tb_hr" /></div>
	  	    		
	  	    	</s:iterator>
  	    	</div>
  	    	<div style="clear:both"></div>
  	    	<!-- 实现分页及跳转页面功能JS -->
		<script type="text/javascript">
			function jumpPage(){
				var input_page=document.getElementById("input_page").value;
				var hidden_totalpage=document.getElementById("hidden_totalpage").value;
				var pattern=/^[0-9]*[1-9][0-9]*$/;
				var flag = pattern.test(input_page);
				if(flag){
					if(input_page>0&&input_page<=hidden_totalpage){
						window.location.href="<%=basePath%>club_getFavoriteTopicListAction?rows=${pagebean.rows}&page="+input_page;
					}
					else{
						document.getElementById("validateMsg").innerHTML="请选择正确的页码！";
						document.getElementById("validateMsg").style.color="red";
					}
				}
				else{
					document.getElementById("validateMsg").innerHTML="请选择正确的页码！";
					document.getElementById("validateMsg").style.color="red";
				}
			}
			
			function check_select_pagesize(){
				var select_pagesize=document.getElementById("select_pagesize").value;
				window.location.href="<%=basePath%>club_getFavoriteTopicListAction?page=1&rows="+select_pagesize;
			}
		</script>
		
		<div class="page_direction">
			<input type="hidden" id="hidden_totalpage" value="${pagebean.totalpage}">
			<!-- 设置每页显示的条数 -->
			每页显示
			<select id="select_pagesize" onchange=check_select_pagesize(this.value)>
				<option value="10"
				    <s:if test="pagebean.rows==10">selected</s:if>>10
				</option>
				<option value="15"
				    <s:if test="pagebean.rows==15">selected</s:if>>15
				</option>
				<option value="20"
				    <s:if test="pagebean.rows==20">selected</s:if>>20
				</option>
				<option value="30"
				    <s:if test="pagebean.rows==30">selected</s:if>>30
				</option>
			</select>条
			<!-- 判断是否是第一页，如果是就不显示上一页按钮 -->
			<s:if test="pagebean.currpage!=1">
				<a href="<%=basePath%>club_getFavoriteTopicListAction?page=${pagebean.currpage-1}&rows=${pagebean.rows}"><span class="page_direction_text">上一页</span></a>
			</s:if>
			<!-- 判断是否是最后一页，如果是就不显示下一页按钮 -->
			<s:if test="pagebean.currpage<pagebean.totalpage">
				<a href="<%=basePath%>club_getFavoriteTopicListAction?page=${pagebean.currpage+1}&rows=${pagebean.rows}"><span class="page_direction_text">下一页</span></a>
			</s:if>
			<!-- 如果页数大于1，提供跳转 -->
			<s:if test="pagebean.totalpage>1">
					跳转到<input type="text" id="input_page" size="2" value="1"/>页
					<input type="button" value="跳转" onclick="jumpPage();">
			</s:if>
			当前第<span class="page_direction_text">${pagebean.currpage}</span>页，共
			<span class="page_direction_text">${pagebean.totalpage}</span>页
			<span class="page_direction_text">${pagebean.totalrecords}</span>篇
			<span id="validateMsg"></span>
		</div>
  	    
	  	</div>
	    <%@ include file="../foot.jsp"%>
	  </div>
  </body>
</html>
